home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1525 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  50 lines

  1. Path: news.ust.hk!cs_lcm
  2. From: cs_lcm@ug.cs.ust.hk (Lee Chun Man Raymond)
  3. Newsgroups: comp.lang.c
  4. Subject: directories listing
  5. Date: 15 Jan 1996 04:16:58 GMT
  6. Organization: The Hong Kong University of Science and Technology
  7. Message-ID: <4dckfq$4um@news.ust.hk>
  8. NNTP-Posting-Host: csl3su39.cs.ust.hk
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.  
  12. Hi,
  13.  
  14.     I wrote a C program that needs to print out a listing of  
  15. sub-directories of current working directory.
  16.  
  17. The following is part of my program : ( Turbo C++ )
  18.  
  19. struct find_t current_file;
  20. int done; 
  21. .........
  22. printf("Directories listing : \n");
  23. done = _dos_findfirst(full_path , FA_DIREC, ¤t_file); 
  24. while (!done) {
  25.    strcpy(file_path, path_name);
  26.    strcat(file_path, "\\");
  27.    strcat(file_path, current_file.name)
  28.    printf("--> %s\n",file_path);
  29.    done = _dos_findnext(¤t_file);
  30.  
  31. I don't know why it lists out all file including the sub-directories, but
  32. I only want to lists our those sub-directories.
  33.  
  34. Would someone help me?
  35.  
  36. Thank you for your attention,
  37.  
  38. Raymond
  39. --
  40.   _______________________________________
  41.  ---------------------------------------|
  42.  | Name : Lee Chun Man Raymond           ||
  43.  | Email: cs_lcm@stu.ust.hk           ||   
  44.  | Computer Science Year 3             ||
  45.  | Hong Kong University of            ||
  46.  |        Science and Technology ||
  47.  ---------------------------------------
  48.  
  49.